package com.cloud.logger.zchain.zchainadmin.controller;

/**
 * User: wcy
 * Date: 2017/9/5
 * Time: 15:45
 */
//@RestController
//@RequestMapping("/user")
//@Api(value = "/用户信息接口", description = "用户信息增删查改等。。。。")
//public class UserCtl {
//
//    @Autowired
//    UserMapper userMapper;
//
//
//    @ApiOperation(value = "通过用户id获取信息")
//    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
//    public UserInfo getUser(@PathVariable long id){
//        return (UserInfo) userMapper.selectByPrimaryKey(id);
//    }
//
//    @ApiOperation(value = "保存用户信息")
//    @PostMapping(value = "")
//    @ResponseBody
//    public ResultMessage<UserInfo> save(@RequestBody UserInfo userInfo){
//        ResultMessage resultMessage = new ResultMessage();
//        if(Strings.isNullOrEmpty(userInfo.getUserName())){
//            resultMessage.setCode(ResultCodeConstant.SERVICE_ERROR_CODE);
//            resultMessage.setMessage("用户名不能为空");
//        }else if(Strings.isNullOrEmpty(userInfo.getPassword())){
//            resultMessage.setCode(ResultCodeConstant.SERVICE_ERROR_CODE);
//            resultMessage.setMessage("密码不能为空");
//        }else if(userInfo.getOrgId()!=null && userInfo.getOrgId()>1){
//            resultMessage.setCode(ResultCodeConstant.SERVICE_ERROR_CODE);
//            resultMessage.setMessage("组织机不能为空");
//        }else{
//            int resultinfo = userMapper.insert(userInfo);
//            if (resultinfo ==1){
//                resultMessage.setCode(ResultCodeConstant.SERVICE_SUCCESS_CODE);
//                resultMessage.setId(userInfo.getId()+"");
//            }else{
//                resultMessage.setCode(ResultCodeConstant.SERVICE_ERROR_CODE);
//            }
//        }
//
//        return resultMessage;
//    }
//
//    @ApiOperation(value = "更新用户信息")
//    @PutMapping(value = "")
//    @ResponseBody
//    public ResultMessage<UserInfo> update(@RequestBody UserInfo userInfo){
//        ResultMessage resultMessage = new ResultMessage();
//        userMapper.updateByPrimaryKey(userInfo);
//
//        resultMessage.setCode(ResultCodeConstant.SERVICE_SUCCESS_CODE);
//
//        return resultMessage;
//    }
//
//    @ApiOperation(value = "通过用户信息获取信息", response = UserInfo.class)
//    @PostMapping(value = "/getUserInfo")
//    @ResponseBody
//    public List<UserInfo> getUserInfo(@RequestParam(value="name",required=false)  String name) {
//        UserInfo userInfo = new UserInfo();
//        userInfo.setUserName(name);
//        return userMapper.select(userInfo);
//    }
//
//    @ApiOperation(value = "通过用户id删除信息", response = UserInfo.class)
//    @DeleteMapping(value = "/{id}")
//    public ResultMessage remove(@PathVariable("id") Long id) {
//        ResultMessage resultMessage = new ResultMessage();
//        userMapper.deleteByPrimaryKey(id);
//        resultMessage.setCode(ResultCodeConstant.SERVICE_SUCCESS_CODE);
//        return  resultMessage;
//    }
//
//}
